﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Pavilion.Communications;

namespace Pavilion.DesignerTool
{
    static public class ResourceTransfer
    {
        static public void Add(ResourceData resourceData)
        {
            DataTransferClient.Instance.TransferData((proxy) => proxy.AddResourceItem(resourceData.ResourceName));

            foreach (AnimationData animationData in resourceData.AnimationDataCollection)
                AnimationTransfer.Add(resourceData.ResourceName, animationData);

            foreach (NodeScriptWrapper nodeScriptWrapper in resourceData.NodeScriptWrapperCollection)
                NodeScriptTransfer.Add(resourceData.ResourceName, nodeScriptWrapper.NodeScript);
        }

        static public void Remove(ResourceData resource)
        {
            DataTransferClient.Instance.TransferData((proxy) => proxy.RemoveResourceItem(resource.ResourceName));
        }

        static public void Rename(string oldName, string newName)
        {
            DataTransferClient.Instance.TransferData((proxy) => proxy.RenameResource(oldName, newName));
        }
    }
}
